package com.petcare;

import java.util.ArrayList;
import com.bd.PetsModule;
import com.bd.AlarmsModule;
import com.bd.Utilities;
import com.bd.VetsModule;

import java.util.List;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;

import android.widget.Button;
import android.widget.TextView;



public class vetdetail extends Activity {
	
	 VetsModule myvet = null;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_vetdetail);
      
        try{
        Bundle bundle = this.getIntent().getExtras();
	    myvet = Utilities.datasource.getVet(bundle.getInt("pk")+"");
	    System.out.println(myvet);
	    }
        catch(Exception e){
        	System.out.println("Exception: " +e);
        }
        
	   
	    TextView vetName = (TextView) findViewById(R.id.TextView01);
	    vetName.setText(myvet.getVetname());
	    
	    TextView textPet = (TextView) findViewById(R.id.TextView9);
	    PetsModule myPet = Utilities.datasource.getPet(myvet.getPetid());
	    textPet.setText(myPet.getName());
	    
	    TextView textPhone = (TextView) findViewById(R.id.TextView04);
	    textPhone.setText(myvet.getVetphone());
	    
	    TextView textAddress = (TextView) findViewById(R.id.TextView05);
	    textAddress.setText(myvet.getVetaddr());
	    
	    final Button button1 = (Button) findViewById(R.id.button1);
        button1.setOnClickListener(new View.OnClickListener() {
            
        	public void onClick(View v) {
        	
            		Bundle bundle = new Bundle();
            		bundle.putInt("pk", myvet.getPk());
    				Intent myIntent = new Intent(vetdetail.this, cambiarvet.class);
    				myIntent.putExtras(bundle);
                	startActivity(myIntent);
                }
            
        });
	    
	    
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
}
